A load balancer is often used to distribute incoming messages amongst multiple service instances. A “stateful” service is a service that tracks state as messages are received. Accordingly, for load balancers that distribute messages to stateful services, the load balancer may “affintize” messages belonging to the same state to the same service instance. On the other hand, for all new messages which are not yet associated with a service instance, the load balancer need not be concerned with affinitization, but can distributed the messages to whichever backend machine is deemed most available.
Affinitization can be advantageous in services where once a service instance begins to process a particular client, that service instance cannot be moved to other machines in the server farm. Basically the state of the service instance could be stored in memory of the local machine and hence cannot be moved to other machines in the farm. As a result, such services might use message affinitization for them to work when deployed on a scaled out server farm.
In other cases, the service deployed on the server farm shares a common state store. And as a result of various other factors including the implementation technology of the service, it is possible that the service instance can be brought back up on a different machine from where it was originally started. Even then, however, if the load balancer continues to pick the same backend machine for processing messages belonging to the same service instance, then it would provide a substantial performance improvement as opposed to spraying messages to various backend machines.